import {
  SET_DDIS_DEVS,
  REFRESH_DDIS_DEVS_START,
  REFRESH_DDIS_DEVS_END,
  SET_TOPO_SUMMARY,
  SET_TOPO_BINDS,
} from '../mutation-types'

// initial state
const state = {
  ddis: {
    list: [],
    loading: false,
  },
  topoSummary: {
    init: false,
    list: []
  },
  topoBinds: {
    init: false,
    list: []
  }
}

// mutations
const mutations = {
  //ddis
  [SET_DDIS_DEVS] (state, val) {
    state.ddis.list = val
  },
  [REFRESH_DDIS_DEVS_START] (state) {
    state.ddis.loading = true
  },
  [REFRESH_DDIS_DEVS_END] (state) {
    state.ddis.loading = false
  },
  //topoSummary
  [SET_TOPO_SUMMARY] (state, val) {
    state.topoSummary.list = val
    state.topoSummary.init = true
  },
  //topoBinds
  [SET_TOPO_BINDS] (state, val) {
    state.topoBinds.list = val
    state.topoBinds.init = true
  },
}

export default {
  state,
  mutations
}